Fix unhandled rejections from "upstream ref ... is not a GitHub repo"#8730
Merged
Conversation
Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/0f354983-7de0-48fd-83e4-7af7fe874a8d Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix sporadic VSCode hangs during extension development
Fix unhandled rejections from "upstream ref ... is not a GitHub repo"
May 7, 2026
alexr00
approved these changes
May 8, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prevents repeated unhandled promise rejections when a workspace folder’s current branch upstream points to a non-GitHub remote, improving stability (especially for frequently re-triggered chat context collection).
Changes:
- Guarded
WorkspaceContextProvider.provideWorkspaceChatContextagainstgetPullRequestDefaults()failures by catching and skipping problematic folders with a debug log. - Made the Copilot-specific error filter in
CategoryTreeNoderesilient to errors that don’t have an HTTPresponseobject by optional-chaining the status/message access.
Show a summary per file
| File | Description |
|---|---|
| src/lm/pullRequestContextProvider.ts | Catches failures from getPullRequestDefaults() to avoid unhandled rejections during workspace chat context generation. |
| src/view/treeNodes/categoryNode.ts | Prevents a secondary exception inside a catch block by optional-chaining e.response.status (and message access). |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
alexdima
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a workspace's branch upstream points at a non-GitHub remote (e.g., a parent folder with a non-GitHub
origin),getPullRequestDefaults()throwsBadUpstreamError. Two callers fail to handle this, producing repeated unhandled promise rejections in the Debug Console — matching the screenshot in the issue and likely correlating with the reported VS Code unresponsiveness, since the chat context provider re-fires on many events.Changes
src/lm/pullRequestContextProvider.ts—WorkspaceContextProvider.provideWorkspaceChatContextawaitedgetPullRequestDefaults()per folder with no try/catch. Wrap it, skip the offending folder, and debug-log its URI. This is the first stack in the screenshot:src/view/treeNodes/categoryNode.ts— The catch handler dide.response.status === 422, which throwsTypeErrorfor any error lacking.response(e.g.BadUpstreamErrorpropagated fromextractRepoFromQuery). Because the throw occurs inside the catch, it escapes as a second unhandled rejection (thegetPullRequestsForQuerystack in the screenshot). Optional-chained the access: